package il.ac.braude.ui.forms.questions;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;


public class QTextField extends FormQuestion {
	JTextField tf = new JTextField(20);

	public QTextField(String question) {
		setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
		JLabel q = new JLabel(question);
		add(q);
		add(Box.createHorizontalGlue());
		add(tf);

	}

	void setEditable(boolean isEditable) {
		tf.setEditable(isEditable);
	}

	@Override
	public void setDefaultAnswer(String defaultAnswer) {
		tf.setText(defaultAnswer);
	}

	@Override
	public String getAnswer() {
		return tf.getText();
	}
}
